import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [

    {
      path: '/',
      name: 'home',
      component: Home,
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('@/views/Register.vue')
    },
    {
      path: '/login',
      name: 'login',
      component: () => import('@/views/Login.vue')
    },
    {
      path: '/putpwd',
      name: 'putpwd',
      component: () => import('@/views/Putpwd.vue')
    },
    {
      path: '/personalcenter', // 个人中心页
      name: 'personalcenter',
      component: () => import('@/views/PersonalCenter.vue'),
      children: [
        {
          path: '/category/add', // 添加分类
          name: 'addcategory',
          component: () => import('@/views/AddCategory.vue')
        },
        {
          path: '/category/put', // 修改分类
          name: 'putcategory',
          component: () => import('@/views/Putcategory.vue')
        },
        {
          path: '/category/select', // 查询分类
          name: 'selectcategory',
          component: () => import('@/views/Selectcategory.vue')
        },
        {
          path: '/uoload', // 修改头像
          name: 'uoload',
          component: () => import('@/views/Uoload.vue')
        },
        {
          path: '/putpwd', // 修改密码
          name: 'putpwd',
          component: () => import('@/views/Putpwd.vue')
        },
        {
         path: '/myblog', // 个人博客
          name: 'myblog',
          component: () => import('@/views/Myblog.vue') 
        },
        {
          path: '/addtag', // 添加标签
          name: 'addtag',
          component: () => import('@/views/Addtag.vue')
        },
        {
          path: '/selecttag', // 查询标签
          name: 'selecttag',
          component: () => import('@/views/Selecttag.vue')
        },
        {
          path: '/puttag', // 修改标签
          name: 'puttag',
          component: () => import('@/views/Puttag.vue')
        },
        {
          path: '/deletag', // 删除标签
          name: 'deletag',
          component: () => import('@/views/Deletag.vue')
        },
        {
          path: '/addblog', // 添加博客
          name: 'addblog',
          component: () => import('@/views/Addblog.vue')
        },
        {
          path: '/deleblog', // 删除博客
          name: 'deleblog',
          component: () => import('@/views/Deleblog.vue')
        },
        {
          path: '/personal', // 个人信息
          name: 'personal',
          component: () => import('@/views/Personal.vue')
        }

      ]
    },

    {
      path: '/articlelist', // 文章详情页
      name: 'articlelist',
      component: () => import('@/views/Articlelist.vue')
    }
  ]
})

export default router
